package com.igeek;

import com.igeek.config.SpringConfig;
import com.igeek.dao.impl.BookDao;
import com.igeek.service.impl.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;

public class App2 {
    public static void main(String[] args) {
        //获取ioc容器
      // ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
        AnnotationConfigApplicationContext ctx=new AnnotationConfigApplicationContext(SpringConfig.class);
        //获取bean
//
//        DataSource dataSource=ctx.getBean(DataSource.class);
//        System.out.println(dataSource);
        //ctx.registerShutdownHook();
       BookDao bookDao=ctx.getBean(BookDao.class);
//       bookDao.update();
//       int num=bookDao.select();
//        System.out.println(num);
        bookDao.findName(100,"bxj");

    }
}
